<html>
<head>
<script type="text/javascript">
function updateGiaNhap() {
		choosenIndex = parseInt(document.getElementById("options").value);	
		if (choosenIndex == 0) {
			document.getElementById("gia_nhap").value="";
			return;
		} else
			//One option is added ('Chon xe...'), so we have to subtract it from index 
			choosenIndex--;
		
		//Send request to server
		xmlhttp=new XMLHttpRequest();
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {
		    	document.getElementById("gia_nhap").value=xmlhttp.responseText;
		    }			
		}
		
		xmlhttp.open("POST", "nhapxe/printSellPrice/"+choosenIndex);		
		xmlhttp.send();
}
</script>
<title><?php echo $title;?></title>
</head>
<body>
	Chon loai xe can nhap: <br/>
	<?php echo form_open('nhapxe/nhapxe_sksm') ?> <br/>
	Loai xe: <?php echo form_dropdown('loaixe', $options,'Loai xe','id="options" onchange="updateGiaNhap()"')?><br/>
	Gia nhap:<?php echo form_input($gia_nhap)?> <br/>
	So luong:<?php echo form_input($so_luong)?> <br/>
	Nguoi nhap: <?php echo $current_user?> <br/>
	<?php echo form_submit('submit_loai_xe','Tiep tuc nhap SK/SM tung xe')?>	
	<?php echo form_close() ?>
</body>
</html>
